package com.powernode.lambda.lambda;

import com.powernode.lambda.Student;

import java.util.stream.Stream;

/**
 * 方法引用之静态方法引用  类名::静态方法
 */
public class Lambda05 {
    public static void main(String[] args) {
        Stream.of(
                new Student("张无忌",26,"男"),
                new Student("赵敏",22,"女"),
                new Student("周芷若",21,"女")
        )
                //(Student stu) -> stu.getSex().equals("女")
                //.filter((Student stu) -> stu.getSex().equals("女"))    lambda表达式
                .filter(Lambda05::ifMethod)     //静态方法引用
                //(Student stu) -> System.out.println(stu)
                //.forEach((Student stu) -> System.out.println(stu))     lambda表达式
                .forEach(Lambda05::forMethod)   //静态方法引用
                ;
    }

    static boolean ifMethod(Student stu){
        return stu.getSex().equals("女");
    }

    static void forMethod(Student stu){
        System.out.println(stu);
    }
}
